package com.liang.text6;

public class Text6 {
    public static void main(String[] args) {

        Student s = new Student();
        Person p = new Student();

        personMethod(p);
        studentMethod(s);

        Person tea = new Teacher();
        personMethod(tea);
    }

    public static void studentMethod(Student stu) {
        stu.mehtod();
    }

    public static void teacherMethod(Teacher teacher) {
        teacher.mehtod();
    }

    public static void personMethod(Person person) {
        person.mehtod();

        if(person instanceof Student) {
            Student s = (Student) person;
            s.study();
        }
    }
}
